package com.example.demo.mapper;

import com.example.demo.entity.Borrow;
import com.example.demo.entity.BorrowExample;
import java.util.List;
import java.util.Map;

import com.example.demo.entity.BorrowHistory;
import com.example.demo.entity.UserHistory;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;


@Repository
public interface BorrowMapper {
    int countByExample(BorrowExample example);

    int deleteByExample(BorrowExample example);

    int deleteByPrimaryKey(Integer id);

    int insert(Borrow record);

    int insertSelective(Borrow record);

    List<Borrow> selectByExample(BorrowExample example);

    Borrow selectByPrimaryKey(Integer id);

    int updateByExampleSelective(@Param("record") Borrow record, @Param("example") BorrowExample example);

    int updateByExample(@Param("record") Borrow record, @Param("example") BorrowExample example);

    int updateByPrimaryKeySelective(Borrow record);

    int updateByPrimaryKey(Borrow record);

    /**
     * 通过uid查询borrow表所有与其相关的借阅信息
     * */
    List<Object> selectByUid(int uid);

    List<UserHistory> myHistory(int id);

    /**
     * 借阅历史
     * */
    List<BorrowHistory> borrowHistory();


    List<BorrowHistory> searchBorrowHistory(String bookname);

    void borrowBook(Map<Object,Object> map);

    void backBook(Map<Object,Object> map);

    int getBookId(int borrowId);
}